aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/thematique/[slug].tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-23 00:20:08 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-23 00:24:39 +0100
commit368fbbf83b913b90cef9dfbe4288e148d589d033 (patch)
treee86d6006dec67ffe485cbab5141609759ce7d501 /src/pages/thematique/[slug].tsx
parent6d514259dd5e60af83b42f938ea9f6b017b7377f (diff)
refactor: rename all subject occurrences into topic
I change the name in graphql endpoint, so I decided to repercute this change here.
Diffstat (limited to 'src/pages/thematique/[slug].tsx')
-rw-r--r--src/pages/thematique/[slug].tsx22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx
index 93b1221..c76831d 100644
--- a/src/pages/thematique/[slug].tsx
+++ b/src/pages/thematique/[slug].tsx
@@ -2,7 +2,7 @@ import { getLayout } from '@components/Layouts/Layout';
import PostPreview from '@components/PostPreview/PostPreview';
import { t } from '@lingui/macro';
import { NextPageWithLayout } from '@ts/types/app';
-import { SubjectPreview, ThematicProps } from '@ts/types/taxonomies';
+import { TopicPreview, ThematicProps } from '@ts/types/taxonomies';
import { loadTranslation } from '@utils/helpers/i18n';
import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from 'next';
import { ParsedUrlQuery } from 'querystring';
@@ -17,28 +17,28 @@ import { useRef } from 'react';
import { ArticleMeta } from '@ts/types/articles';
import Head from 'next/head';
import Sidebar from '@components/Sidebar/Sidebar';
-import { Article, Blog, Graph, WebPage } from 'schema-dts';
+import { Article, Graph, WebPage } from 'schema-dts';
import { config } from '@config/website';
import { useRouter } from 'next/router';
const Thematic: NextPageWithLayout<ThematicProps> = ({ thematic }) => {
- const relatedSubjects = useRef<SubjectPreview[]>([]);
+ const relatedTopics = useRef<TopicPreview[]>([]);
const router = useRouter();
- const updateRelatedSubjects = (newSubjects: SubjectPreview[]) => {
- newSubjects.forEach((subject) => {
- const subjectIndex = relatedSubjects.current.findIndex(
- (relatedSubject) => relatedSubject.id === subject.id
+ const updateRelatedTopics = (newTopics: TopicPreview[]) => {
+ newTopics.forEach((topic) => {
+ const topicIndex = relatedTopics.current.findIndex(
+ (relatedTopic) => relatedTopic.id === topic.id
);
- const hasSubject = subjectIndex === -1 ? false : true;
+ const hasTopic = topicIndex === -1 ? false : true;
- if (!hasSubject) relatedSubjects.current.push(subject);
+ if (!hasTopic) relatedTopics.current.push(topic);
});
};
const getPostsList = () => {
return [...thematic.posts].reverse().map((post) => {
- updateRelatedSubjects(post.subjects);
+ updateRelatedTopics(post.topics);
return (
<li key={post.id} className={styles.item}>
@@ -123,7 +123,7 @@ const Thematic: NextPageWithLayout<ThematicProps> = ({ thematic }) => {
)}
</div>
<Sidebar position="right">
- <RelatedTopics topics={relatedSubjects.current} />
+ <RelatedTopics topics={relatedTopics.current} />
<ThematicsList title={t`Other thematics`} />
</Sidebar>
</article>